{template 'common/header'}
<ul class="nav nav-tabs">
	<li {if $operation == 'display' && $status == '100'}class="active"{/if}>
	<a href="{php echo $this->createWebUrl('scorder', array('op' => 'display', 'status' => 100))}">全部商城订单</a>
	</li>
	
	{if $operation == 'detail'}
	<li class="active">
		<a href="#">订单详情</a>
	</li>
	{/if}
</ul>

{if $operation == 'display'}

<div class="main">
	<div class="panel panel-info">
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="cy163_salesjl" />
				<input type="hidden" name="do" value="scorder" />
				
				<div class="form-group">
					<label class="col-xs-12 col-sm-1 control-label">订单号</label>
					<div class="col-sm-4 col-xs-12">
						<input class="form-control" name="keyword" type="text" value="{$_GPC['keyword']}" placeholder="可查询订单号">
					</div>
				</div>
		
				<div class="form-group">	
					<label class="col-xs-12 col-sm-1 control-label"></label>
					<div class="col-sm-6 col-xs-12">
						<input type="hidden" name="status" value="{$status}" />
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
				
						<button type="button" class="btn btn-default">总记录数：{$total}</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="panel panel-default">
		<div class="panel-heading">订单 </div>
		<div class="panel-body table-responsive">
			<table class="table table-hover">
				<thead class="navbar-inner">
				<tr>
					<th style="width:5%;">id</th>
					<th style="width:10%;">订单号</th>
					<th style="width:20%;">收货信息</th>
					<th style="width:8%;">电话</th>
					<th style="width:8%;">总价</th>
					<th style="width:6%;">状态</th>
					<th style="width:20%;">下单时间</th>
	
					 <th style="width:20%;"></th>
					
					<th style="text-align:right;">操作</th>
				</tr>
				</thead>
				<tbody>
				<form action="" method="post">
				{loop $list $item}
				<tr>
					<td>{$item['id']}</td>
					<td>{$item['ordersn']}</td>
					<td>{$item['address']}</td>
					<td>
						{$item['phone']}
					</td>
					<td>{$item['allmoney']} 元</td>
					<td>
						{if $item['state'] == 0}<span class="label label-default">未支付</span>{/if}
						{if $item['state'] == 1}<span class="label label-danger">已支付</span>{/if}
						{if $item['state'] == 2}<span class="label label-info">用户取消订单</span>{/if}
						{if $item['state'] == 3}<span class="label label-info">待收货</span>{/if}
                        {if $item['state'] == 5}<span class="label label-success">已完成</span>{/if}
                    </td>
                    
					<td>{php echo date('Y-m-d H:i:s', $item['addtime'])}</td>
					
					                    
                    {if $item['state'] == 1 }
                    
                    <td style="text-align:right;">
						<a style="color:red; background:black" href="{php echo $this->createWebUrl('scorder', array('op' => 'yifahuo', 'id' => $item['id']))}" class="btn btn-sm">点击发货</a>
					</td>
                    
                    {/if}
                    
					<td style="text-align:right;">
						<a href="{php echo $this->createWebUrl('scorder', array('op' => 'detail', 'id' => $item['id']))}" class="btn btn-success btn-sm">查看订单</a>
					</td>
				</tr>
				{/loop}
				<tr>
				
					
				</tr>
				</form>
				</tbody>
			</table>
		</div>
	</div>
</div>
{$pager}
<script type="text/javascript">
	require(['daterangepicker'], function($){
		$('.daterange').on('apply.daterangepicker', function(ev, picker) {
			$('#form1')[0].submit();
		});
	});
	$("#selectAll").click(function(){  
		$(":checkbox").each(function(){   
			$(this).prop("checked", true);
		});
	});
	$("#unSelect").click(function(){  
		$(":checkbox").each(function(){   
			$(this).prop("checked", false);
		});
	});
</script>

{elseif $operation == 'detail'}
<div class="main">
	<form class="form-horizontal form" action="" method="post" enctype="multipart/form-data">
	<div class="panel panel-default">
		<div class="panel-heading">
			订单信息
		</div>
		
		
		
		<div class="panel-body">
		
		
		
	{if $item['product']['title'] !=''}
		
		    <div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">商品名称</label>
				<div class="col-sm-9 col-xs-12">
					<p class="form-control-static">{$item['product']['title']}</p>
				</div>
			</div>
			<div class="form-group">v
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">金额 :</label>
				<div class="col-sm-9 col-xs-12">
					<p class="form-control-static">{$item['price']} 元</p>
				</div>
			</div>
			
	{/if}
			
			

			
		{if $item['jsCartInfo'] != ''}
			<div class="form-group">v
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">订单总金额 :</label>
				<div class="col-sm-9 col-xs-12">
					<p class="form-control-static">{$item['allmoney']} 元</p>
				</div>
			</div>

	     {/if}

			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">订单状态 :</label>
				<div class="col-sm-9 col-xs-12">
					<p class="form-control-static">
						{if $item['state'] == 0}<span class="label label-default">未支付</span>{/if}
						{if $item['state'] == 1}<span class="label label-danger">已支付</span>{/if}
						{if $item['state'] == 2}<span class="label label-info">用户取消订单</span>{/if}
						{if $item['state'] == 3}<span class="label label-info">待收货</span>{/if}
                        {if $item['state'] == 5}<span class="label label-success">已完成</span>{/if}
					</p>
				</div>
			</div>
			
			
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">下单日期 :</label>
				<div class="col-sm-9 col-xs-12">
					<p class="form-control-static">{php echo date('Y-m-d H:i:s', $item['addtime'])}</p>
				</div>
			</div>

		</div>
		
	</div>
	

	<div class="panel panel-default">
		<div class="panel-heading">
			用户信息
		</div>
		<div class="panel-body">
			
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">姓名 :</label>
				<div class="col-sm-9 col-xs-12">
					<p class="form-control-static">{$item['user']['nickname']}</p>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">手机 :</label>
				<div class="col-sm-9 col-xs-12">
					<p class="form-control-static">{$item['address']['phone']}</p>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">地址 :</label>
				<div class="col-sm-9 col-xs-12">
					<p class="form-control-static">{$item['address']['province']}{$item['address']['city']}{$item['address']['area']}{$item['address']['detailaddr']}</p>
				</div>
			</div>
			
		</div>
	</div>

{if $item['product']['title'] != ''}

	<div class="panel panel-default">
		<div class="panel-heading">商品信息</div>
		<div class="panel-body table-responsive">
			<table class="table table-hover">
				<thead class="navbar-inner">
				<tr>
					<th style="width:5%;">ID</th>
					<th style="width:10%;">商品标题</th>
					<th style="width:15%;">总价格</th>
					<th style="width:5%;">数量</th>
				</tr>
				</thead>
				
				<tr>
					<td>{$item['product']['id']}</td>
					<td>{$item['product']['title']}</td>
					<td><span class="label label-info">{$item['allmoney']}</span></td>
					<td>{$item['nums']}</td>
				</tr>
			
				
			</table>
		</div>
	</div>
	
{/if}
	
	
	{if $item['jsCartInfo'] != ''}

		<div class="panel panel-default">
			<div class="panel-heading">商品信息</div>
			<div class="panel-body table-responsive">
				<table class="table table-hover">
					<thead class="navbar-inner">
					<tr>
						<th style="width:5%;"></th>
						<th style="width:10%;">商品名称</th>
						<th style="width:15%;">单件总价格</th>
						<th style="width:5%;">数量</th>
					</tr>
					</thead>
					{loop $item['jsCartInfo'] $items}
						<tr>
							<td></td>
							<td>{$items['pro_name']}</td>
							<td><span class="label label-info">{$items['oneprice']}</span></td>
							<td>{$items['nums']}</td>
						</tr>
				   {/loop}
				</table>
			</div>
		</div>
	
	{/if}

	
	</form>
</div>

<script language='javascript'>
	$(function(){
	});
</script>
{/if}
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
</script>
{template 'common/footer'}